<template>
  <div class="question-list-item">
    <div>
      <p class="title">{{options.title}}</p>
      <div class="author-info">
        <span class="author-meta">
          <i class="icon-web-user"></i>
          作者：{{options.author.name}}
        </span>
        <span class="author-meta">
          <i class="icon-web-time-circle"></i>
          发布于：{{options.createTime | formatDate}}
        </span>
        <span class="author-meta">
          <i class="icon-web-eye"></i>
          阅读次数：{{options.readNum}}
        </span>
      </div>
      <div class="content">{{options.content}}</div>
    </div>
    <div class="question-action">
      <el-button @click="handleOnClick">
        <span class="el-button_text">
          阅读全文
          <i class="icon-web-doubleright"></i>
        </span>
      </el-button>
    </div>
  </div>
</template>
<script>
export default {
  props: {
    options: {
      type: Object,
      default: {}
    },
    index: Number
  },
  methods: {
    handleOnClick() {
      this.$emit('on-click', [this.options, this.index]);
    }
  }
}
</script>
<style lang="less" scoped>
.question-list-item {
  width: 100%;
  padding: 20px 10px;
  position: relative;
  background-color: #ffffff;
  margin-bottom: 10px;
  box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.1);
  cursor: default;
  .title {
    font-size: 22px;
    color: #222222;
  }
  .content {
    font-size: 16px;
    color: #222222;
    margin: 25px 0 0;
  }
  .author-info {
    display: flex;
    font-size: 13px;
    color: #999999;
    margin-top: 10px;
    .author-meta {
      padding-right: 5px;
      margin-right: 5px;
      display: flex;
      align-items: center;
      position: relative;
      &:last-child::after {
        height: 0;
      }
      &::after {
        content: "";
        width: 1px;
        height: 80%;
        position: absolute;
        top: 50%;
        right: 0;
        transform: translateY(-50%);
        background-color: #999999;
      }
    }
  }
  .question-action {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: 12px;
    .el-button_text {
      display: flex;
      align-items: center;
    }
  }
}
</style>
